#include <iostream>
#include <string>
#include <vector>

using namespace std;

class Log_in
{
private:
    string user;
    string password;

public:
    Log_in() {}
    Log_in(string user, string password) : user(user), password(password) {}
    ~Log_in() {}

    bool user_log_in()
    {
        string my_user;
        string my_password;

        cout << "请输入账号" << endl;
        cin >> my_user;
        cout << "请输入密码" << endl;
        cin >> my_password;

        if (this->user == my_user)
        {
            if (this->password == my_password)
            {
                cout << "登陆成功" << endl;
                return true;
            }
        }

        return false;
    }
};

typedef struct book
{
    string name;
    int id;
}book;

int main(int argc, char const *argv[])
{
    // Log_in log_in("张三", "张三的密码");
    // // 登陆
    // log_in.user_log_in();

    // 初始化容器
    book book_test;
    book book_data[10] = {
        {.name = "《母猪产后护理》" , .id = 1},
        {.name = "《关于找对象的101种技巧》" , .id = 2},
        {.name = "《富婆通讯录》" , .id = 3},
        {.name = "《霸道总裁爱上我》" , .id = 4},
        {.name = "《如何一夜暴富》" , .id = 5},
        {.name = "《郑迎佳自传》" , .id = 6},
        {.name = "《葵花宝典&辟邪剑谱修炼心得》" , .id = 7}
    };

    vector<book> book_list;

    // 初始化
    for (size_t i = 0; i < 7; i++)
    {
        book_list.push_back(book_data[i]);
    }



    // 增加图书 增加图书 借阅 归还
    while (1)
    {
        cout << "请输入你要操作的功能" << endl;
        cout << "1、增加图书 2、删除图书 3、遍历图书" << endl;

        int val;
        int id;
        string name; // 增  删（尾删） 查找 改
        cin >> val;

        switch (val)
        {
        case 1:
            cout << "请输入 图书名称" << endl;
            cin >> book_test.name;
            cout << "请输入 图书编号" << endl;
            cin >> book_test.id;

            // 插入图书
            book_list.push_back(book_test);

            cout << "插入成功" << endl;

            break;
        case 2:
            cout << "删除最好一本书" << endl;
            book_list.pop_back();
            break;
        case 3:
            for (vector<book>::iterator it = book_list.begin(); it != book_list.end(); it++)
            {
                book_test = *it;
                cout << "书名:" << book_test.name << " 编号:" << book_test.id << endl;
            }
            
            break;
        default:
            break;
        }
    }

    return 0;
}



